package com.huluobo.a2205kotlinjetpackdemo.hilt

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.ViewModelProvider
import com.huluobo.a2205kotlinjetpackdemo.R
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class HiltActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_hilt)

        val viewModel = ViewModelProvider(this)[LoginViewModel::class.java]
        viewModel.login().let {
            Log.i("TagA", "user$it")
        }
    }
}

class SimCard @Inject constructor() {
    fun dialNumber() {
        Log.i("TagA", "拨打电话")
    }
}

class MobilePhone @Inject constructor() {
    fun dialNumber() {
        val simCard = SimCard()
        simCard.dialNumber()
    }

    fun dialNumber2(simCard: SimCard) {
        simCard.dialNumber()
    }
}

